package band.wukong.practice.javase.core.io.typicalUsage;

import java.io.*;

/**
 * Desc: 基本的文件输出
 * Author: sunjs
 * Date: 2009-12-18 13:32:18
 */
public class BasicFileOutput {
    static final String FILE_IN = "src\\com\\jsun\\javase\\corepackage\\io\\testdir\\poem.txt";
    static final String FILE_OUT = "src\\com\\jsun\\javase\\corepackage\\io\\testdir\\out.txt";

    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(
                new StringReader(BufferedInputFile.read(FILE_IN))
        );

        PrintWriter out = new PrintWriter(
                new BufferedWriter(new FileWriter(FILE_OUT))
        );

        int lineCount = 1;
        String s;
        while((s = in.readLine()) != null) {
            out.println(lineCount++ + ": " + s);
        }
        out.close();
        System.out.println(BufferedInputFile.read(FILE_OUT));
    }
}
